package com.mzy.datepackage.M2022.July.eleventh;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;

/**
 * Created with IntelliJ IDEA.
 *
 * @Author mzy
 * @Date 2022/7/11 11:21
 * @Version 1.0
 */
public class Test {
    public static void main(String[] args) {
        HashMap<String, String> hashMap = new HashMap<>();

        hashMap.put("1","小明");
        hashMap.put("2","小黄");
        hashMap.put("3","小李");
        hashMap.put("4","小莫");

        hashMap.forEach((k,v)-> System.out.println(k + "   "+ v));

        hashMap.put("2","小王");
        System.out.println("--------------------------");

        hashMap.forEach((k,v)-> System.out.println(k + "   " + v));
    }





    @org.testng.annotations.Test
    public  void test() {
        HashMap<String, String> map1 = new HashMap<>();
        map1.put("123", "aaa");
        map1.put("23456", "bbb");

        System.out.println("map1的循环遍历");
        for (Map.Entry<String, String> entry : map1.entrySet()) {
            System.out.println(entry.getKey() + "  " +entry.getValue());
        }

        HashMap<String, String> map2 = new HashMap<>(map1.size());
        map2.put("123", "aaa");
        map2.put("23456", "bbb");
        System.out.println("map2的循环遍历");
        for (Map.Entry<String, String> entry : map2.entrySet()) {
            System.out.println(entry.getKey()+ "  " +entry.getValue());
        }
    }


    @org.testng.annotations.Test
    public void test03(){
        HashMap<String, String> objectObjectHashMap = new HashMap<>();
        objectObjectHashMap.put("1","小明");

        ArrayList<String> objects = new ArrayList<>();
        objects.add("小明");

        if (objectObjectHashMap.get("1").equals(objects.get(0))){
            System.out.println(111);
        }
    }
}
